package com.xin.controller;

import com.xin.constants.CommonResult;
import com.xin.service.PermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/permission")
@Api(tags = "权限列表")
public class PermissionController {
    @Resource
    private PermissionService permissionService;

    /**
     * 分页查找所有权限信息
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/findList")
    @ApiOperation("分页查找所有权限列表")
    public CommonResult<?> findList(Integer page,Integer size){

        return CommonResult.success(this.permissionService.findAll(page,size),"请求成功");
    }

    @ApiOperation("以树的形式返回所有权限列表")
    @GetMapping("/findListByTree")
    public CommonResult<?> findListByTree(){
        return CommonResult.success(this.permissionService.findAllByTree(),"请求成功");
    }

}
